package w

import (
	"Software/global"
	"fmt"
	"github.com/go-webauthn/webauthn/webauthn"
)

func GetWebauthn() *webauthn.WebAuthn {
	authn, err := webauthn.New(&webauthn.Config{
		RPID:          global.Config.GetString("webauthn.RPID"),
		RPDisplayName: global.Config.GetString("webauthn.RPDisplayName"),
		RPOrigins:     []string{global.Config.GetString("RPOrigins")},
	})

	if err != nil {
		fmt.Println(err)
		return nil
	}

	return authn
}
